"use strict";
var select_task_id = 0;
var select_dom_id = 0;


	
	Mousetrap.bind('ctrl+up', function(e) {
        if(!select_dom_id){
            layer.msg('请先用鼠标点选一个任务！',{time: 2000});
        }
		var $obj=$("#"+select_dom_id).prev(".task");
		console.log($obj);
		if($obj.length>0){
			$(".selected").removeClass('selected');
			$obj.addClass('selected');
			select_dom_id=$obj.attr('id');
			select_task_id = $obj.attr('data-taskid');
			console.log(select_dom_id);
			console.log(select_task_id);			
		}
	});
	
	Mousetrap.bind('ctrl+down', function(e) {
        if(!select_dom_id){
            layer.msg('请先用鼠标点选一个任务！',{time: 2000});
        }
		var $obj=$("#"+select_dom_id).next(".task");
		console.log($obj);
		if($obj.length>0){
			$(".selected").removeClass('selected');
			$obj.addClass('selected');
			select_dom_id=$obj.attr('id');
			select_task_id = $obj.attr('data-taskid');
			console.log(select_dom_id);
			console.log(select_task_id);			
		}
	});
	
	Mousetrap.bind('ctrl+left', function(e) {
        if(!select_dom_id){
            layer.msg('请先用鼠标点选一个任务！',{time: 2000});
        }
		var $obj=$("#"+select_dom_id).parent(".task");
		console.log($obj);
		if($obj.length>0){
			$(".selected").removeClass('selected');
			$obj.addClass('selected');
			select_dom_id=$obj.attr('id');
			select_task_id = $obj.attr('data-taskid');
			console.log(select_dom_id);
			console.log(select_task_id);			
		}
	});

	Mousetrap.bind('ctrl+right', function(e) {
        if(!select_dom_id){
            layer.msg('请先用鼠标点选一个任务！',{time: 2000});
        }
		var $obj=$("#"+select_dom_id).children(".task").first();
		console.log($obj);
		if($obj.length>0){
			$("#"+select_dom_id).children(".task").show();
			$(".selected").removeClass('selected');
			$obj.addClass('selected');
//			$obj.show();
			select_dom_id=$obj.attr('id');
			select_task_id = $obj.attr('data-taskid');
			console.log(select_dom_id);
			console.log(select_task_id);			
		}
	});

	Mousetrap.bind('ctrl+ins', function(e) {
        if(!select_dom_id){
            layer.msg('请先用鼠标点选一个任务！',{time: 2000});
        }
		if(select_task_id && select_dom_id){
			call_add_child_input(select_task_id,select_dom_id);
		}
	});

	
/* 	
$(document).keypress(function (event) {
	
    if(event.ctrlKey) {
		switch (event.keyCode) {
			case 37:
//				alert('方向键-左');
				$("#"+select_dom_id).parent(".task").css('background-color', 'red');
				console.log($("#"+select_dom_id).parent(".task"));
				break;
			case 39:
				$("#"+select_dom_id).prev(".task").css('background-color', 'red');
				break;
			 case 38:
				$("#"+select_dom_id).children(".task").css('background-color', 'red');
				break;
			 case 40:
				$("#"+select_dom_id).next(".task").css('background-color', 'red');
				break;	
			case 107:
				console.log('按下+键');
//				console.log(current_opt_dom_id+"---"+current_opt_task_id);
//				if(current_opt_task_id){
//					call_add_child_input();
//				}
		}
		
    }
    return;
}); */
